<template>
	<view class="myCode">
		<u-navbar title='我的邀请码' :background="{ background: '#6EC9E1' }" :fixed="true" :placeholder="true"
			:border-bottom="false" :autoBack="true" title-color="#FFF" back-icon-color="#FFF">
		</u-navbar>
		<view class="user-img">
			<u-avatar size='large' :src="info.avatar"></u-avatar>
		</view>
		<view class="scanCode">
			<view class="codeImg">
				<uni-icons class="refu" @click="refu" type="refreshempty" size="30"></uni-icons>
				<view class="title" v-show='user.job==2'>
					扫码：自动加好友，自动得3次回访问卷。
				</view>
				<image class="image" :src="info.code" mode="widthFix"></image>
				<view class="text" v-show='user.job==2'>
				<!-- 	<p>面谈过，熟悉</p>
					<p>可以给对方二维码</p>
					<p>获得回访、交流机会</p> -->
					
					<p>二维码24小时有效</p>
					<p>{{ info.nowTime }}</p>
				</view>
			</view>
		</view>

		<view class="rmk">
			<p>技术工作，孰能生巧,</p>
			<p>三日不练，手生荆棘,</p>
		</view>
		<view class="rmk">
			<p>我们的生活护航员，</p>
			<p>每天都在一线实战，</p>
			<p>线上，只为关注疗效回访！</p>
		</view>

	</view>
</template>

<script>
	import {
		userCode
	} from '@/api/index.js'
	export default {
		data() {
			return {
				info: {},
				user: '',
			}
		},
		onLoad(e) {
			this.init()
			this.user = this.ws.getUserInfo();

		},
		methods: {
			init() {
				let that = this

				userCode(that.user).then(res => {
					that.info = res.data
				})
			},
			refu() {
				if (this.user.job == 2) {
					this.info.code = ''
					this.init()
				}
			}
		},

	}
</script>

<style lang="less">
	.myCode {
		height: 100vh;
		background-color: #6EC9E1;
		padding-top: 44rpx;

		.title {
			padding: 20rpx 0;
			text-align: center;
			color: #333;
		}

		image {
			position: relative;
			z-index: 99;
		}

		.user-img {
			display: flex;
			justify-content: center;
		}

		.rmk {
			position: relative;
			top: -40rpx;
			text-align: center;
			font-family: 思源黑体;
			font-size: 13px;
			font-weight: normal;
			line-height: 26px;
			text-align: center;
			letter-spacing: 0em;
			font-feature-settings: "kern" on;
			color: #FFFFFF;
			margin-top: 20px;
		}

		.scanCode {
			width: 80vw;
			text-align: center;
			background-color: #FFFF;
			border-radius: 20rpx;
			margin: auto;
			position: relative;
			top: -70rpx;
			display: flex;
			flex-flow: column;
			justify-content: center;
			align-items: center;
			padding-top: 70rpx;
			position: relative;

			.refu {
				position: absolute;
				top: 10rpx;
				right: 10rpx;
				z-index: 999;
			}

			.codeImg {
				margin: 0 auto;

				.image {
					width: 223px;
				}

				.text {
					width: 223px;
					margin: 0 auto;
					font-family: 思源黑体;
					font-size: 13px;
					font-weight: normal;
					line-height: 22px;
					text-align: center;
					letter-spacing: 0em;
					font-feature-settings: "kern" on;
					color: #6EC9E1;
				}
			}
		}

	}
</style>